cmake_minimum_required(VERSION 3.16)

project(QDynamicForm LANGUAGES CXX)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Sql)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Sql)

add_library(QDynamicForm SHARED
  QDynamicForm_global.h
  qdynamicform.cpp
  qdynamicform.h
  qtableattribute.h
  qtableattribute.cpp
  widgets/qmanagerwidget.h
  widgets/qmanagerwidget_p.h
  widgets/qmanagerwidget.cpp
  widgets/qinsertwidget.h
  widgets/qinsertwidget_p.h
  widgets/qinsertwidget.cpp
  widgets/qupdatewidget.h
  widgets/qupdatewidget_p.h
  widgets/qupdatewidget.cpp
  widgets/inputwidgetutils.h
  widgets/inputwidgetutils.cpp
  widgets/helputils.h
  widgets/helputils.cpp
)

target_link_libraries(QDynamicForm PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Sql )

target_compile_definitions(QDynamicForm PRIVATE QDYNAMICFORM_LIBRARY)
